import axios from '../../../utils/axios'
Page({
    data: {
        title: '',
        showList: []

    },
    //options(Object)
    async onLoad(options) {
        console.log(options);
        switch (options.showType) {
            case 'showClass':
                // 获取课堂展示
                let classList = await axios({
                    url: '/api/classroom/show',
                    data: {
                        page: 0,
                        size: 10
                    },
                    header: {
                        'Authorization': wx.getStorageSync('token')
                    }
                });
                classList.data.content.forEach(item => item.images = item.images.split(','))
                this.setData({
                    title: '课堂展示',
                    showList: classList.data.content
                })
                break;
            case 'talent':
                // 获取少儿达人
                let talentList = await axios({
                    url: '/api/juvenile/talent',
                    data: {
                        page: 0,
                        size: 10
                    },
                    header: {
                        'Authorization': wx.getStorageSync('token')
                    }
                });
                talentList.data.content.forEach(item => item.images = item.images.split(','))
                this.setData({
                    title: '少儿达人',
                    showList: talentList.data.content
                })
                break;

            default:
                break;
        }

    },
    onReady: function () {

    },
    onShow: function () {

    },
    onHide: function () {

    },
    onUnload: function () {

    },
    onPullDownRefresh: function () {

    },
    onReachBottom: function () {

    },
    onShareAppMessage: function () {

    },
    onPageScroll: function () {

    },
    //item(index,pagePath,text)
    onTabItemTap: function (item) {

    },
    goToDetail() {
        wx.navigateTo({
            url: './detail/detail',
        });
    }
});